﻿using System;
using System.IO;
using SEXY;
using UnityEngine;

namespace Character
{
	// Token: 0x02000198 RID: 408
	public class ColorParameter_PBR1 : ColorParameter_Base
	{
		// Token: 0x06000AB5 RID: 2741 RVA: 0x0003DDB0 File Offset: 0x0003BFB0
		public ColorParameter_PBR1()
		{
		}

		// Token: 0x06000AB6 RID: 2742 RVA: 0x0003DDD0 File Offset: 0x0003BFD0
		public ColorParameter_PBR1(ColorParameter_PBR1 copy)
		{
			this.Copy(copy);
		}

		// Token: 0x06000AB7 RID: 2743 RVA: 0x0003DDF8 File Offset: 0x0003BFF8
		public ColorParameter_PBR1(Material material)
		{
			this.mainColor1 = material.color;
			this.specColor1 = material.GetColor(CustomDataManager._SpecColor);
			this.specular1 = material.GetFloat(CustomDataManager._Metallic);
			this.smooth1 = material.GetFloat(CustomDataManager._Smoothness);
		}

		// Token: 0x06000AB8 RID: 2744 RVA: 0x0003DE60 File Offset: 0x0003C060
		public override COLOR_TYPE GetColorType()
		{
			return COLOR_TYPE.PBR1;
		}

		// Token: 0x06000AB9 RID: 2745 RVA: 0x0003DE64 File Offset: 0x0003C064
		public void Copy(ColorParameter_PBR1 copy)
		{
			this.mainColor1 = copy.mainColor1;
			this.specColor1 = copy.specColor1;
			this.specular1 = copy.specular1;
			this.smooth1 = copy.smooth1;
		}

		// Token: 0x06000ABA RID: 2746 RVA: 0x0003DE98 File Offset: 0x0003C098
		public override void Save(BinaryWriter writer)
		{
			base.Save_ColorType(writer);
			base.WriteColor(writer, this.mainColor1);
			base.WriteColor(writer, this.specColor1);
			writer.Write(this.specular1);
			writer.Write(this.smooth1);
		}

		// Token: 0x06000ABB RID: 2747 RVA: 0x0003DED4 File Offset: 0x0003C0D4
		public override bool Load(BinaryReader reader, CUSTOM_DATA_VERSION version)
		{
			if (version < CUSTOM_DATA_VERSION.DEBUG_04)
			{
				base.ReadColor(reader, ref this.mainColor1);
				return true;
			}
			COLOR_TYPE color_TYPE = ColorParameter_Base.Load_ColorType(reader, version);
			if (color_TYPE == COLOR_TYPE.NONE)
			{
				return false;
			}
			if (color_TYPE != this.GetColorType())
			{
				GlobalData.Debug_LogError("颜色类型不同");
			}
			base.ReadColor(reader, ref this.mainColor1);
			base.ReadColor(reader, ref this.specColor1);
			this.specular1 = reader.ReadSingle();
			this.smooth1 = reader.ReadSingle();
			return true;
		}

		// Token: 0x06000ABC RID: 2748 RVA: 0x0003DF50 File Offset: 0x0003C150
		public void FromSexyData(HSColorSet colorSet)
		{
			this.mainColor1 = colorSet.rgbaDiffuse;
			this.specColor1 = colorSet.rgbSpecular;
			this.specular1 = colorSet.specularIntensity;
			this.smooth1 = colorSet.specularSharpness;
		}

		// Token: 0x06000ABD RID: 2749 RVA: 0x0003DF84 File Offset: 0x0003C184
		public override void SetToMaterial(Material material)
		{
			material.color = this.mainColor1;
			material.SetColor(CustomDataManager._SpecColor, this.specColor1);
			material.SetFloat(CustomDataManager._Metallic, this.specular1);
			material.SetFloat(CustomDataManager._Smoothness, this.smooth1);
		}

		// Token: 0x04000ABA RID: 2746
		public Color mainColor1 = Color.white;

		// Token: 0x04000ABB RID: 2747
		public Color specColor1 = Color.white;

		// Token: 0x04000ABC RID: 2748
		public float specular1;

		// Token: 0x04000ABD RID: 2749
		public float smooth1;
	}
}
